use "C:\Users\morrisl\Dropbox\Tolerance\California Survey 1.dta", clear

gen tolerant=1 if Q33==1
replace tolerant=0 if Q33==2|Q33==3

gen treatment=Q33_part1_rand
la de treatment 1 "ext rw" 2 "mainst rw" 3 "mainst lw" 4 "ext rw"
la val treatment treatment

gen collgrad=1 if educ==5|educ==6
replace collgrad=0 if educ<=4
la de collgrad 0 "Not College Graduate" 1 "College Graduate"
la val collgrad collgrad

gen age=2017-birthyr
gen age2=1 if age<=40
replace age2=2 if age>40 & age!=.

gen ideo3=1 if ideo5<=2
replace ideo3=2 if ideo5==3
replace ideo3=3 if ideo5==4|ideo5==5
la de ideo3 1 liberal 2 moderate 3 conservative
la val ideo3 ideo3

table treatment [aweight=weight], contents(mean tolerant)
table treatment age2 [aweight=weight], contents(mean tolerant)
table treatment collgrad [aweight=weight], contents(mean tolerant)
table treatment ideo3 [aweight=weight], contents(mean tolerant)


clear

use "C:\Users\morrisl\Dropbox\Tolerance\California Survey 2.dta", clear

gen treatment=1 if Q36A1!=.
replace treatment=2 if Q36A2!=.
replace treatment=3 if Q36A3!=.
replace treatment=4 if Q36B1!=.
replace treatment=5 if Q36B2!=.
replace treatment=6 if Q36B3!=.

la de treatment 1 "asking for it" 2 "not automatic" 3 "stay at home" 4 "mosques" 5 "islam and dem" 6 "catholic church"
la val treatment treatment

egen dv=rmean(Q36A1-Q36B3)

gen tolerant=1 if dv==1
replace tolerant=0 if dv==2|dv==3

gen age2=1 if Q38<=40
replace age2=2 if Q38>40 & Q38!=.

gen collgrad=1 if Q39==7|Q39==8
replace collgrad=0 if Q39<7

gen ideo3=1 if Q45==4|Q45==5
replace ideo3=2 if Q45==3
replace ideo3=3 if Q45<=2

table treatment [aweight=WEIGHT], contents(mean tolerant)
table treatment age2 [aweight=WEIGHT], contents(mean tolerant)
table treatment collgrad [aweight=WEIGHT], contents(mean tolerant)
table treatment ideo3 [aweight=WEIGHT], contents(mean tolerant)

clear

